package creditcard.mvc;

import framework.account.IAccount;
import framework.mvc.ACustomButton;
import framework.mvc.AFincoView;
import framework.mvc.FincoContext;

import java.util.Map;

public class GenerateMonthlyBillButton extends ACustomButton {

    public GenerateMonthlyBillButton(AFincoView view) {
        super(view, "Generate Monthly Bill");
    }

    @Override
    public void fireClick() {
        int rowSelectedIndex = view.getRowSelectedIndex();
        if (rowSelectedIndex == -1)
            return;

        IAccount account = FincoContext.getFinco().getSelectedAccount(rowSelectedIndex);
         MonthlyBillReportDialog dialog = new MonthlyBillReportDialog(view, account);
        dialog.setVisible(true);
    }
}

